﻿<template>
  <crud
    :entity-name="entityName"
    :dialog-enity.sync="entity"
    :request-param="pagerequest"
    :keyword-placeholder="keywordPlaceholder"
    :dialog-optins="dialogOptins"
    @dialogFormClearValidate="handleFormClearValidate"
    @dialogFormValidate="handleFormValidate"
  >
    <template slot="FilterItems" />

    <template slot="TableColumns">

      <el-table-column
        prop="receiverId"
        sortable="custom"
        :label="L('ReceiverId')"
      />
      <el-table-column
        prop="taskContent"
        sortable="custom"
        :label="L('TaskContent')"
      />
    </template>

    <createOrUpdateCommonTask
      ref="CreateOrEditDialog"
      slot="CreateOrEditDialog"
      :entity="entity"
    />
  </crud>
</template>
<script>
import crud from '@/components/CrudCodeBuild'
import createOrUpdateCommonTask from './components/CreateOrUpdateCommonTask'
export default {
  name: 'CommonTask',
  components: { crud, createOrUpdateCommonTask },
  data() {
    return {
      entity: {},
      entityName: 'commonTask',
      pagerequest: null,
      keywordPlaceholder: this.L('CommonTask') + '/' + this.L('Name'),
      dialogOptins: {
        width: '700px',
        createEnityParam: { permissions: [] },
        createTitle: this.L('Create'),
        editTitle: this.L('Edit'),
        deleteConfirm: this.L('Delete')
      }
    }
  },
  methods: {
    handleIsActiveChange(val) {
      if (val === 'Actived') {
        this.pagerequest.isActive = true
      } else if (val === 'NoActive') {
        this.pagerequest.isActive = false
      } else {
        this.pagerequest.isActive = null
      }
    },
    handleFormClearValidate() {
      this.$refs.CreateOrEditDialog.clearValidate()
    },
    handleFormValidate(cb) {
      this.$refs.CreateOrEditDialog.validate(cb)
    }
  }

}

</script>
